<!-- /* Description for file.
 * 添加寻访人
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/resources
 * @since         ues
 * @version       V0.0.1
 * @modifiedby   会兵2011年0630
 * @lastmodified  会兵2011年0630
 */
 -->

<?php
echo $html->css ( 'jquery-validate/css/screen' );
echo $html->css ( 'tab' );
echo $html->css('start/jquery-ui-1.8.2.custom');
//echo $javascript->link ( 'jquery' );
echo $javascript->link('jquery-ui-1.8.2.custom.min');
?>

<script type="text/javascript">
var IND = IND1 = COM = '';
//验证是否必填
function test(id)
{
	var srt = "font#" + id;
	var isValidate =  $(srt).text();
	var validate = $.trim(isValidate);
	if(validate == "*"){
		return true;
	} else {
		return false;
	}
}

$(document).ready(function(){
	//检测重名按钮-----检测重名
	$("#checkname").click(function(){
		if($("#visitorrecordsmobilePhone").val()!=""){
			if(verifyName()==false){
				alert("该寻访人已存在，手机号码重复！");
			}
			else{
				alert("可以添加该寻访人！");
			}
		}
		else{
			alert("请先输入手机号码");
		}
	});
});
//检测重名
function verifyName(){
	var shorName=$("#visitorrecordsmobilePhone").val();
	var param= [{'name':"mobilePhone",'value':shorName}];
	if(shorName!=""){
		flag=true;
		$.ajax({
			type: 'POST',
			url: "<?php echo ROOT_WEB_PATH; ?>/visitorrecords/sameName/",
			async: false,
			data: param,
			dataType:"xml",
			success: function(xml)
			{
				$(xml).find("aaa").each(function(i){
					var id = $(this).text();
					if(id == "false")
					{
						flag=false;
						return false;
					};
				});
			}
		});
		return flag;
	}
	else {

	}
}
//添加验证
$(document).ready(function() {

	$.validator.setDefaults({
		submitHandler: function(form) {
			if($("#visitorrecordsmobilePhone").val()!=""){
				if(verifyName()==false){
					alert("该寻访人已存在，手机号码重复！");
				}
				else{
					form.submit();
				}
			}
			else	form.submit();
		}
	});

	$("#VisitorrecordSaveForm").validate({
		rules: {
		"data[Visitorrecord][professional1]":{
			required: test("competency"),selectNone:true
		},
		"data[Visitorrecord][industry1]":{
			required: test("industry"),selectNone:true
		},
		"data[Visitorrecord][sex]":{
			required: test("sex"),selectNone:true
		},
		"data[Visitorrecord][workarea]":{
			required: test("workarea"),selectNone:true
		},
		"data[Visitorrecord][position1]":{
			required: test("position"),selectNone:true
		},
		"data[Visitorrecord][previousCompany]":{
			required: test("previousCompany"),selectNone:true
		},
		"data[Visitorrecord][name]":{
			required: false,formatOfName:true,stringMinLength:0,stringMaxLength:50
		},
		"data[Visitorrecord][age]":{
			required: false,digits:true
		},
		"data[Visitorrecord][tel]":{
			required: test("tel"),phone:true
		},
		"data[Visitorrecord][email]":{
			required: false,email:true
		},
		"data[Visitorrecord][mobilePhone]":{
			required: false,mobile:true
		},
		"data[Visitorrecord][remindBefore]":{
			required: false,digits:true
		},
		"data[Visitorrecord][remindSpacing]":{
			required: false,digits:true
		},
		"data[Visitorrecord][acceptanceCause]":{
			required: false
		},
		"data[Visitorrecord][backgroundInquiry]":{
			required: false
		},
		"data[Visitorrecord][visitorMind]":{
			required: test("visitorMind")
		}
		},
		//		messages:{
		//			"data[Visitorrecord][tel]":{required: "请输入"}},
		focusInvalid:false,
		onkeyup:false,
		errorPlacement:function(error, element){error.appendTo(element.parent());}

	});
});
//验证结束

</script>

<script type="text/javascript">
//日期选择框
$(function(){
	$(".datepickerSpan :input").datepicker({
		inline: true
	});
	$('.datepickerSpan :input').datepicker('option', {dateFormat: "yy-mm-dd"});
	$('.datepickerSpan :input').datepicker( "option", "closeText", 'X' );
});

$(document).ready(function(){
	//项目公司与项目职位的关联菜单
	$("#VisitorrecordProgramcompany").change(function(){
		var IndustryDroptoplist = $(this).val();
		if(IndustryDroptoplist!="")
		{
			$.post("<?php echo ROOT_WEB_PATH; ?>/visitorrecords/getrecruitposition/",{
				Recruitposition : $(this).val()
			},
			function(data,textStatus){
				$("#VisitorrecordRecruitposition:eq(0)>option").remove();
				$(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					$("#VisitorrecordRecruitposition:eq(0)").append("<option></option>");
					$("#VisitorrecordRecruitposition:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
				});
			});
		}
		else
		{
			window.location.reload();
		}
	});
	//现在公司选择
	$("#visitorrecordspreviousCompany").change(function(){
		$("#visitorrecordsCompany").val($(this).val());
	});
	$('#searchbutton').click(function(){
		var SC = $('#searchCompany').val();
		var NowIND = $("#VisitorrecordIndustry1 option:selected").val();
		var NowIND1 = $("#VisitorrecordIndustry2 option:selected").val();
		if(COM == ''){
			COM = getCOM();
		}
		if(IND!=NowIND || IND1!=NowIND1){
			IND = NowIND;
			IND1 = NowIND1;
			COM = getCOM();
		}
		if(COM=='')	return;
		var C_ary = COM.split('|#|');
		$("#visitorrecordspreviousCompany:eq(0)>option").remove();
		$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
		$("#visitorrecordspreviousCompany:eq(0)>option:last").val("").html("不限");
		for(var i=0;i<C_ary.length;i++){
			var v = C_ary[i];
			if(v=='') continue;
			if(SC=='' || v.indexOf(SC.toUpperCase())!=-1 || v.indexOf(SC.toLowerCase())!=-1){
				$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
				$("#visitorrecordspreviousCompany:eq(0)>option:last").val(v).html(v);
			}
		}
	});
	function getCOM(){
		var N_com = '';
		$('#visitorrecordspreviousCompany option').each(function(){
			N_com += $(this).val()+"|#|";
		});
		return N_com;
	}

	//项目职位与项目的关联菜单
	$("#VisitorrecordRecruitposition").change(function(){
		var IndustryDroptoplist = $(this).val();
		if(IndustryDroptoplist!="")
		{
			$.post("<?php echo ROOT_WEB_PATH; ?>/visitorrecords/getcompanymanage/",{
				Projectmanagement : $(this).val()
			},
			function(data,textStatus){
				$("#VisitorrecordProjectmanagementId:eq(0)>option").remove();
				$(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					$("#VisitorrecordProjectmanagementId:eq(0)").append("<option></option>");
					$("#VisitorrecordProjectmanagementId:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
				});
			});
		}
		else
		{
			$("#VisitorrecordProjectmanagementId:eq(0)>option").remove();
			$("#VisitorrecordProjectmanagementId:eq(0)").append("<option></option>");
			$("#VisitorrecordProjectmanagementId:eq(0)>option:last").val("").html("不限");
		}
	});

	//行业二级菜单
	$("#VisitorrecordIndustry1").change(function(){
		var IndustryDroptoplist = $(this).val();
		if(IndustryDroptoplist!="")
		{
			$("#visitorrecordsindustry").val($("#VisitorrecordIndustry1 option:selected").text() + "_");
			$.post("<?php echo ROOT_WEB_PATH; ?>/industries/industriesQuery/",{
				Industry : $(this).val()
			},
			function(data,textStatus){
				$("#VisitorrecordIndustry2:eq(0)>option").remove();
				$(data).find("aaa").each(function(){
//					alert($(this).attr("name"));
					$("#VisitorrecordIndustry2:eq(0)").append("<option></option>");
					$("#VisitorrecordIndustry2:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
				});
			});

			$.post("<?php echo ROOT_WEB_PATH; ?>/companymanages/getCompany/",{
				Industry : $("#VisitorrecordIndustry1 option:selected").text()
			},
			function(data,textStatus){
				$("#visitorrecordspreviousCompany:eq(0)>option").remove();
				$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
				$("#visitorrecordspreviousCompany:eq(0)>option:last").val("").html("不限");
				$(data).find("aaa").each(function(){
					$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
					$("#visitorrecordspreviousCompany:eq(0)>option:last").val($(this).text()).html($(this).text());
				});
			});
		}
		else
		{
			$.post("<?php echo ROOT_WEB_PATH; ?>/companymanages/getCompany/",{
				Industry : ''
			},
			function(data,textStatus){
				$("#visitorrecordspreviousCompany:eq(0)>option").remove();
				$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
				$("#visitorrecordspreviousCompany:eq(0)>option:last").val("").html("不限");
				$(data).find("aaa").each(function(){
					$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
					$("#visitorrecordspreviousCompany:eq(0)>option:last").val($(this).text()).html($(this).text());
				});
			});
			$("#VisitorrecordIndustry2:eq(0)>option").remove();
			$("#VisitorrecordIndustry2:eq(0)").append("<option></option>");
			$("#VisitorrecordIndustry2:eq(0)>option:last").val("").html("不限");
			$("#visitorrecordsindustry").val("");
		}
	});
	//行业二级菜单
	$("#VisitorrecordIndustry2").change(function(){
		var IndustryDroptoplist = $(this).val();
		if(IndustryDroptoplist!="")
		{
			$("#visitorrecordsindustry").val($("#visitorrecordsindustry").val() + $("#VisitorrecordIndustry2 option:selected").text());
			
			$.post("<?php echo ROOT_WEB_PATH; ?>/companymanages/getCompany/",{
				Industry : $("#VisitorrecordIndustry2 option:selected").text()
			},
			function(data,textStatus){
				$("#visitorrecordspreviousCompany:eq(0)>option").remove();
				$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
				$("#visitorrecordspreviousCompany:eq(0)>option:last").val("").html("不限");
				$(data).find("aaa").each(function(){
					$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
					$("#visitorrecordspreviousCompany:eq(0)>option:last").val($(this).text()).html($(this).text());
				});
			});
		}
		else
		{
			$.post("<?php echo ROOT_WEB_PATH; ?>/companymanages/getCompany/",{
				Industry : $("#VisitorrecordIndustry1 option:selected").text()
			},
			function(data,textStatus){
				$("#visitorrecordspreviousCompany:eq(0)>option").remove();
				$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
				$("#visitorrecordspreviousCompany:eq(0)>option:last").val("").html("不限");
				$(data).find("aaa").each(function(){
					$("#visitorrecordspreviousCompany:eq(0)").append("<option></option>");
					$("#visitorrecordspreviousCompany:eq(0)>option:last").val($(this).text()).html($(this).text());
				});
			});
		}
	});


	//职位二级菜单
	$("#VisitorrecordPosition1").change(function(){
		var IndustryDroptoplist = $(this).val();
		if(IndustryDroptoplist!="")
		{
			$("#visitorrecordsposition").val($("#VisitorrecordPosition1 option:selected").text() + "_");
			$.post("<?php echo ROOT_WEB_PATH; ?>/positions/getPosition/",{
				Position : $(this).val()
			},
			function(data,textStatus){
				$("#VisitorrecordPosition2:eq(0)>option").remove();
				$(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					$("#VisitorrecordPosition2:eq(0)").append("<option></option>");
					$("#VisitorrecordPosition2:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
				});
			});
		}
		else
		{
			$("#VisitorrecordPosition2:eq(0)>option").remove();
			$("#VisitorrecordPosition2:eq(0)").append("<option></option>");
			$("#VisitorrecordPosition2:eq(0)>option:last").val("").html("不限");
			$("#visitorrecordsposition").val("");
		}
		$("#visitorrecordsposition1").val($("#visitorrecordsposition").val());
	});
	$("#VisitorrecordPosition2").change(function(){
		var IndustryDroptoplist = $(this).val();
		if(IndustryDroptoplist!="")
		{
			$("#visitorrecordsposition").val($("#VisitorrecordPosition1 option:selected").text() + "_" + $("#VisitorrecordPosition2 option:selected").text());
		}
		else
		{
			$("#visitorrecordsposition").val($("#VisitorrecordPosition1 option:selected").text() + "_");
		}
		$("#visitorrecordsposition1").val($("#visitorrecordsposition").val());
	});

	//职能二级菜单
	$("#VisitorrecordProfessional1").change(function(){
		var CompetencyDroptoplist = $(this).val();
		if(CompetencyDroptoplist!="")
		{
			$("#visitorrecordscompetency").val($("#VisitorrecordProfessional1 option:selected").text() + "_");
			$.post("<?php echo ROOT_WEB_PATH; ?>/competencies/getcompetencies/",{
				Competency : $(this).val()
			},function(data,textStatus){
				$("#VisitorrecordProfessional2:eq(0)>option").remove();
				$(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					$("#VisitorrecordProfessional2:eq(0)").append("<option></option>");
					$("#VisitorrecordProfessional2:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
					$("#VisitorrecordProfessional3:eq(0)>option").remove();
					$("#VisitorrecordProfessional3:eq(0)").append("<option></option>");
					$("#VisitorrecordProfessional3:eq(0)>option:last").val("").html("不限");
				});
			});
		}
		else
		{
			$("#VisitorrecordProfessional2:eq(0)>option").remove();
			$("#VisitorrecordProfessional2:eq(0)").append("<option></option>");
			$("#VisitorrecordProfessional2:eq(0)>option:last").val("").html("不限");
			$("#VisitorrecordProfessional3:eq(0)>option").remove();
			$("#VisitorrecordProfessional3:eq(0)").append("<option></option>");
			$("#VisitorrecordProfessional3:eq(0)>option:last").val("").html("不限");
			$("#visitorrecordscompetency").val("");
		}
		$("#visitorrecordscompetency1").val($("#visitorrecordscompetency").val());
	});

	//职能三层字段 级联菜单 //
	$("#VisitorrecordProfessional2").change(function(){
		var list = $(this).val();
		if(list!="")
		{
			$("#visitorrecordscompetency").val($("#VisitorrecordProfessional1 option:selected").text() + "_" + $("#VisitorrecordProfessional2 option:selected").text() + "_");
			$.post("<?php echo ROOT_WEB_PATH; ?>/competencies/getcompetencies/",{
				Competency : $(this).val()
			},function(data,textStatus){
				$("#VisitorrecordProfessional3:eq(0)>option").remove();
				$(data).find("aaa").each(function(){
					//	 alert($(this).attr("name"));
					$("#VisitorrecordProfessional3:eq(0)").append("<option></option>");
					$("#VisitorrecordProfessional3:eq(0)>option:last").val($(this).attr("name")).html($(this).text());
				});
			});
		}
		else
		{
			$("#VisitorrecordProfessional3:eq(0)>option").remove();
			$("#VisitorrecordProfessional3:eq(0)").append("<option></option>");
			$("#VisitorrecordProfessional3:eq(0)>option:last").val("").html("不限");
			$("#visitorrecordscompetency").val($("#VisitorrecordProfessional1 option:selected").text() + "_");
		}
		$("#visitorrecordscompetency1").val($("#visitorrecordscompetency").val());
	});
	$("#VisitorrecordProfessional3").change(function(){
		var list = $(this).val();
		if(list!="")
		{
			if($("#VisitorrecordProfessional1 option:selected").text()!="不限"&&$("#VisitorrecordProfessional1 option:selected").text()!="不限")
			$("#visitorrecordscompetency").val($("#VisitorrecordProfessional1 option:selected").text() + "_" + $("#VisitorrecordProfessional2 option:selected").text() + "_" + $("#VisitorrecordProfessional3 option:selected").text());
			else
			$("#visitorrecordscompetency").val("");
		}
		else
		{
			if($("#VisitorrecordProfessional1 option:selected").text()!="不限"&&$("#VisitorrecordProfessional2 option:selected").text()!="不限")
			$("#visitorrecordscompetency").val($("#VisitorrecordProfessional1 option:selected").text() + "_" + $("#VisitorrecordProfessional2 option:selected").text() + "_");
			else
			$("#visitorrecordscompetency").val("");
		}
		$("#visitorrecordscompetency1").val($("#visitorrecordscompetency").val());
	});
});
//省份城市
$(function(){
	//省份级联菜单 //
	$("#VisitorrecordProvinceId").change(function(){
		var workareaf = "" ;
		$('#VisitorrecordProvinceBaseid').val($(this).val());
		var list = $('#VisitorrecordProvinceBaseid option:selected').text();
		$("#visitorrecordsworkarea").val($("#VisitorrecordProvinceId option:selected").text() + '-');
		if(list!="")
		{
			$.post("<?php echo ROOT_WEB_PATH; ?>/cities/getProvince/",{
				provicnceid : list
			},
			function(data,textStatus){
				$("#VisitorrecordCityId:eq(0)>option").remove();
				$(data).find("aaa").each(function(){
					// alert($(this).attr("name"));
					$("#VisitorrecordCityId:eq(0)").append("<option></option>");
					$("#VisitorrecordCityId:eq(0)>option:last").val($(this).attr("name")).html($(this).text());

				});
				if($("#VisitorrecordCityId option:selected").html() != null){
					workareaf = $("#VisitorrecordProvinceId option:selected").text() + '-' +$("#VisitorrecordCityId option:selected").html();
				}
				else{
					workareaf = $("#VisitorrecordProvinceId option:selected").text() + '-';
				}
				$("#visitorrecordsworkarea").val(workareaf);

			});
		}
	});
	$("#VisitorrecordCityId").change(function(){
		var citylist = $(this).val();
		if(citylist!="")
		{
			if($("#VisitorrecordProvinceId option:selected").text()!=""&&$("#VisitorrecordCityId option:selected").text()!="")
			$("#visitorrecordsworkarea").val($("#VisitorrecordProvinceId option:selected").text() + "-" + $("#VisitorrecordCityId option:selected").text());
			else
			$("#visitorrecordsworkarea").val("");
		}
		else
		{
			if($("#VisitorrecordProvinceId option:selected").text()!=""&&$("#VisitorrecordProvinceId option:selected").text()!="")
			$("#visitorrecordsworkarea").val($("#VisitorrecordProvinceId option:selected").text() + "-");
			else
			$("#visitorrecordsworkarea").val("");
		}
	});
	$(".datepickerSpan :input").datepicker({
		inline: true
	});
	$('.datepickerSpan :input').datepicker('option', {dateFormat: "yy-mm-dd"});
	$('.datepickerSpan :input').datepicker( "option", "closeText", 'X' );
});

</script>
<style>
.input{float:left;}
</style>
<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Visitor Management');//一级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('Visitor Management Addvistor',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->

<?php echo $form->create('Visitorrecord',array('action'=>'save','type'=> 'post'));?>
<?php echo $form->hidden('table',array('id'=>'table','default'=>$table));?>	
<?php echo $form->hidden('cop',array('default'=>$cop));?>	


<div class="tabflex">
<fieldset><legend><?php __('Visitorrecord Add');?></legend>
<table width="100%" cellspacing="0" cellpadding="0" border="0"
	style="text-align: left">
	<!--当前行业下拉-->
	<tr>
		<td></td>
		<td><?php __('当前行业');?>:
			<font color="red" id="industry">
				<?php if($fields['industry'] == 1 && $fields['industry'] !=null){echo "*";}?>
			</font>	
		</td>
		<td colspan="4">
		<?php 
		echo $form->input('nowindustry',array('label'=>false,'id'=>'visitorrecordsindustry','style'=>"width:32%;"));
		$options = array();
		foreach($industries as $eachrecord)
		{
			$options[$eachrecord['Industry']['id']] = $eachrecord['Industry']['name'];
		}
		echo $form->input('industry1',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
		echo $form->input('industry2',array('options'=>array('0'=>'不限'),'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
		echo $form->hidden('industry',array('id'=>'visitorrecordsindustry3'));
		?>
		</td>
		</tr>
		<!--现在公司下拉-->
		<tr>
		<td></td>
		<td><?php __('现在公司');?>:
			<font color="red" id="previousCompany">
				<?php if($fields['previousCompany'] == 1 && $fields['previousCompany'] !=null){echo "*";}?>
			</font>	
		</td>
		<td colspan="4" nowrap>
		<?php 
		echo $form->input('nowpreviousCompany',array('label'=>false,'id'=>'visitorrecordsCompany','readonly'=>true,'style'=>"width:32%;",'value'=>$cop));
		$options = array();
		foreach($companymanages as $eachrecord)
		{
			$options[$eachrecord['Companymanage']['name']] = $eachrecord['Companymanage']['name'];
		}
		echo $form->input('previousCompany',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1','id'=>'visitorrecordspreviousCompany','default'=>$cop));	
		?>
		<input type="text" id = 'searchCompany' style='width:80px;'>
		<input type="button" id="searchbutton" value="查">
		<?php 
		echo $html->link('新增公司', '/companymanages/addvisitorcom', array('class'=>'btn4'),null,array('escape'=>false)); 
		?>
		</td>
		</tr>
		<tr>
		<td ></td>
		<td><?php __('职能');?>:
			<font color="red" id="professional">
				<?php 
				if($fields['professional'] == 1 && $fields['professional'] !=null){echo "*";}?>
			</font>	
		</td>
		<!--职能下拉-->
		<td colspan="4">
		<?php 
		echo $form->input('nowcompetency',array('label'=>false,'id'=>'visitorrecordscompetency1','readonly'=>true,'style'=>"width:32%;"));
		$options = array();
		foreach($professions as $eachrecord)
		{
			$options[$eachrecord['Competency']['id']] = $eachrecord['Competency']['name'];
		}
		echo $form->input('professional1',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
		echo $form->input('professional2',array('options'=>array('0'=>'不限'),'label'=>false,'div'=>false,'class'=>'TextBoxE1'));		
		echo $form->input('professional3',array('options'=>array('0'=>'不限'),'label'=>false,'div'=>false,'class'=>'TextBoxE1'));		
				?>
				
		<?php 
		echo $form->hidden('competency',array('id'=>'visitorrecordscompetency'));
		?>
		</td>
		</tr>
		<tr>
			<td ></td>
			<td><?php __('现在职位');?>:
				<font color="red" id="position">
				<?php if($fields['position'] == 1 && $fields['position'] !=null){echo "*";}?>
			</font>	
			</td>
			<!--现在职位下拉-->
			<td colspan="4">
			<?php 
			echo $form->input('nowposition',array('label'=>false,'id'=>'visitorrecordsposition1','readonly'=>true,'style'=>"width:32%;"));
			$options = array();
			foreach($positions as $eachrecord)
			{
				$options[$eachrecord['Position']['id']] = $eachrecord['Position']['name'];
			}
			echo $form->input('position1',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
			echo $form->input('position2',array('options'=>array('0'=>'不限'),'label'=>false,'div'=>false,'class'=>'TextBoxE1'));		
			echo $form->hidden('position',array('label'=>false,'id'=>'visitorrecordsposition'));
			?>
			</td>
		</tr>
		<tr>
		<!--现工作地区下拉-->
			<td ></td>
			<td ><?php __('现在工作地区');?>:
				<font color="red" id="workarea">
				<?php if($fields['workarea'] == 1 && $fields['workarea'] !=null){echo "*";}?>
			</font>	
			</td>
			<!--
			<?php //echo $form->input('position2',array('options'=>array('0'=>'--'),'label'=>false,'div'=>false,'class'=>'TextBoxE1'));		
					?>
			<td colspan="4">				
			<?php 
					//echo $form->hidden('workarea',array('label'=>false,'id'=>'visitorrecordsworkarea'));
			?>
			</td>
			-->
			<td colspan="4">
			<?php echo $form->input('workarea',array('label'=>false,'value'=>$visitorFieldDefault,'div'=>false,'readonly'=>true,'id'=>'visitorrecordsworkarea','style'=>'width:32%'));
			$options = array();
			$optionsbase = array();
			foreach($provinces as $eachrecord)
			{
				$options[$eachrecord['Province']['id']] = $eachrecord['Province']['name'];
				$optionsbase[$eachrecord['Province']['id']] = $eachrecord['Province']['baseid'];
			}
			echo $form->input('province_id',array('options'=>$options,'label'=>false,'div'=>false,'default'=>$provinceid));
			echo $form->input('province_baseid',array('options'=>$optionsbase,'label'=>false,'div'=>false,'style'=>"display:none;"));
			 $options = array();
			foreach($cities as $eachrecord)
			{
				$options[$eachrecord['City']['id']] = $eachrecord['City']['name'];
			}
			echo $form->input('city_id',array('options'=>$options,'label'=>false,'div'=>false,'default'=>$cityid));
			 ?>	
		</td>	
		</tr>
		<tr>
		<td width="5%"></td>
		<td width="10%"><?php __('候选人姓名');?>:</td>
		<td width="20%">
		<?php 	
		echo $form->input('name',array('label'=>false,'id'=>'visitorrecordsname'));
		?> 
		</td>
		<!--性别下拉-->
		<td width="5%"></td>
		<td width="10%"><?php __('性别');?>:
			<font color="red" id="sex">
				<?php if($fields['sex'] == 1 && $fields['sex'] !=null){echo "*";}?>
			</font>	
		</td>
		<td width="20%">
		<?php echo $form->input('sex',
		array(
		'options'=>array(''=>'未知','男'=>'男','女'=>'女'),
		'label'=>false,'div'=>false,'class'=>'TextBoxE1','id'=>'visitorrecordssex'));
		?>
		</td>
		</tr>
		<tr>
		<td></td>
		<td ><?php __('生日');?>:</td>
		<td>
		<span class="datepickerSpan">
		<!--<input type='text' name="birthday" class='sitems' id="visitorrecordsbirthday" />-->
		<?php
		echo $form->input('birthday',array('type'=>'text','label'=>false,'id'=>'visitorrecordsbirthday'))
		?>
		</span>
			<?php 
			//echo $form->input('birthday',array('type'=>'date','minYear'=>'1950','dateFormat'=>'YMD','monthNames' => false,'label'=>false,'id'=>'visitorrecordsbirthday'));
			?>
		<!--生日-->
		</td>
		<!--年龄-->
		<td ></td>
		<td ><?php __('年龄');?>:</td>
		<td>
			<?php 	
			echo $form->input('age',array('label'=>false,'id'=>'visitorrecordsage'));
			?> 
		</td>
		</tr>
		<tr>
		<!--学历-->
		<td ></td>
		<td ><?php __('学历');?>:</td>
		<td>
			<?php $options = array();
			foreach($advanceddegreeranks as $eachrecord)
			{
				$options[$eachrecord['Advanceddegreerank']['name']] = $eachrecord['Advanceddegreerank']['name'];
			}
			echo $form->input('advancedDegree',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1','id'=>'visitorrecordsadvancedDegree'));
				?>
		</td>
		<!--现工作时间-->
		<td ></td>
		<td ><?php __('现工作开始时间');?>:</td>
		<td><span class="datepickerSpan">
		<!--<input type='text' name="startworkdate" class='sitems' id="visitorrecordsstartworkdate" />-->
		<?php
		echo $form->input('startworkdate',array('type'=>'text','label'=>false,'id'=>'visitorrecordsstartworkdate'))
		?>
		</span>
			<?php 
			//echo $form->input('startworkdate',array('type'=>'date','dateFormat'=>'YMD','monthNames' => false,'label'=>false,'id'=>'visitorrecordsstartworkdate'));
			?>
		</td>
		</tr>
		
		<tr>
		<!--工作电话-->
		<td ></td>
		<td ><?php __('工作电话');?>:
			<font color="red" id="tel">
				<?php if($fields['tel'] == 1 && $fields['tel'] !=null){echo "*";}?>
			</font>	
		</td>
		<td>
			<?php 	
			echo $form->input('tel',array('label'=>false,'id'=>'visitorrecordstel'));
			?> 
		</td>
		<!--电子邮箱-->
		<td ></td>
		<td ><?php __('电子邮箱');?>:</td>
		<td>
			<?php 	
			echo $form->input('email',array('label'=>false,'id'=>'visitorrecordsemail'));
			?> 
		</td>
		</tr>
		<tr>
		<!--简历等级-->
		<td></td>
		<td ><?php __('简历等级');?>:</td>
		<td>
			<?php $options = array();
			foreach($resumeranks as $eachrecord)
			{
				$options[$eachrecord['Resumerank']['name']] = $eachrecord['Resumerank']['name'];
			}
			echo $form->input('resumerank',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
				?>
		</td>
		<!--手机号码-->
		<td ></td>
		<td ><?php __('手机号码');?>:</td>
		<td>
			<?php 	
			echo $form->input('mobilePhone',array('label'=>false,'id'=>'visitorrecordsmobilePhone'));
			?> 
			<?php echo "<input type='button' value='检测重复' class='btn4' id='checkname' ></input>"?>
		</td>
		</tr>
</table>
</fieldset>
<fieldset><legend><?php __('项目信息');?></legend>
<div class="tabflex">
<table width="100%" cellspacing="0" cellpadding="0" border="0"
	style="text-align: left">
	<tr>
	<!--项目-->
		<td width="5%"></td>
		<td width="10%"><?php __('项目公司');?>:</td>
		<td width="15%">
		<?php $options = array();
		foreach($companymanages as $eachrecord)
		{
			$options[$eachrecord['Companymanage']['id']] = $eachrecord['Companymanage']['name'];
		}
		echo $form->input('programcompany',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
				?>
		</td>
		<td width="5%"></td>
		<td width="10%"><?php __('项目职位');?>:</td>
		<td width="15%">
		<?php $options = array();
		foreach($recruitpositions as $eachrecord)
		{
			$options[$eachrecord['Recruitposition']['name']] = $eachrecord['Recruitposition']['name'];
		}
		echo $form->input('recruitposition',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
				?>
		</td>
		<td width="5%"></td>
		<td width="10%"><?php __('项目订单');?>:</td>
		<td width="15%">
			<?php $options = array();
			foreach($projectmanagements as $eachrecord)
			{
				$options[$eachrecord['Projectmanagement']['id']] = $eachrecord['Projectmanagement']['projectCode'];
			}
			echo $form->input('projectmanagement_id',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
				?>
		</td>
	</tr>
	</table>
	</fieldset>
	<fieldset><legend><?php __('创建信息');?></legend>
	<table width="100%" cellspacing="0" cellpadding="0" border="0"
	style="text-align: left">
	<tr>
	<!--创建人-->
	<td width="5%"></td>
	<td width="10%"><?php __('创建人');?>:</td>
	<td width="20%">
		<?php 
		echo $form->input('creater',array('default'=>$creater,'label'=>false,'disabled'=>"disabled"));
		?>
	</td>
		<!--创建日期-->
	<td width="5%"></td>	
	<td width="10%"><?php __('创建日期');?>:</td>
	<td width="20%">
		<?php 
		echo $form->input('created',array('type'=>'text','default'=>$createddate,'label'=>false,'disabled'=>'disabled'));
		//echo $form->input('created',array('default'=>$createddate,'label'=>false,'timeFormat'=>'24','dateFormat'=>'YMD','monthNames' => false,'disabled'=>"disabled"));
		?>
	</td>
	</tr>
	<tr>
	<!--下次联系时间-->
	<td></td>
	<td><?php __('下次联系时间');?>:</td>
	<td colspan="4">
	<span class="datepickerSpan">
		<?php 
		echo $form->input('nextLinkDate',array('type'=>'text','label'=>false,'default'=>date('Y-m-d')));
		?>
		</span>
		<?php
		echo $form->input('nextLinkTime',array('type'=>'time','label'=>false,'dateFormat'=>'YMD', 'timeFormat'=> '24','monthNames' => false));
		?>
	</td>
	</tr>
	<tr>
	<!--提前提醒-->
	<td></td>
	<td ><?php __('提前提醒');?>:</td>
	<td>
		<?php 
		echo $form->input('remindBefore',array('label'=>false,'after'=>'&nbsp;天'));
		?>
	</td>
		<td></td>
		<td><?php __('提前间隔');?>:</td>
		<td>
		<?php 
		echo $form->input('remindSpacing',array('label'=>false,'after'=>'&nbsp;分'));
		?>
		</td>
	</tr>
	</table>
	</fieldset>
	<fieldset><legend><?php __('寻访信息');?></legend>
	<table width="100%" cellspacing="0" cellpadding="0" border="0"
	style="text-align: left">
	<!--寻访状态-->
	<tr>
	<td width="5%"></td>
	<td width="10%"><?php __('寻访状态');?>:</td>
	<td width="20%">
			<?php $options = array();
			foreach($visitorstates as $eachrecord)
			{
				$options[$eachrecord['Visitorstate']['id']] = $eachrecord['Visitorstate']['name'];
			}
			echo $form->input('visitorstate_id',array('empty' =>'不限','options'=>$options,'label'=>false,'div'=>false,'class'=>'TextBoxE1'));
				?>
		</td>
	<!--寻访时间-->
	<td width="5%"></td>
	<td width="10%"><?php __('寻访时间');?>:</td>
	<td width="20%">
	<span class="datepickerSpan">
	<?php
	echo $form->input('visitorDate',array('type'=>'text','label'=>false,'default'=>date('Y-m-d')));
	?>
	</span>
		<?php 
		echo $form->input('visitorTime',array('type'=>'time','label'=>false,'dateFormat'=>'YMD', 'timeFormat'=> '24','monthNames' => false));
		?>
	</td>
	</tr>
	<tr>
	<!--入选原因-->
	<td></td>
	<td><?php __('入选原因');?>:</td>
	<td colspan="4">
		<?php 
		echo $form->textarea('acceptanceCause',array('label'=>false,'class'=>'areaStyle'));
		?>
	</td>
	</tr>
	<tr>
	<!--背景调查-->
	<td></td>
	<td><?php __('背景调查');?>:</td>
	<td colspan="4">
		<?php 
		echo $form->textarea('backgroundInquiry',array('label'=>false,'class'=>'areaStyle'));
		?>
	</td>
	</tr>
	<tr>
	<!--寻访印象-->
	<td></td>
	<td><?php __('寻访印象');?>:
		<font color="red" id="visitorMind">
				<?php if($fields['visitorMind'] == 1 && $fields['visitorMind'] !=null){echo "*";}?>
			</font>	
	</td>
	<td colspan="4">
		<?php 
		echo $form->textarea('visitorMind',array('label'=>false,'class'=>'areaStyle','id'=>'visitorrecordsvisitorMind'));
		?>
	</td>
	</tr>
	
</table>
</fieldset>
</div>
<table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
	<tr>
		<td width="50"></td>
		<td width="100"><?php echo $form->button('确定',array('type'=>'submit','class'=>'btn2'));?>  <!-- __('reset', true)取消-->
		<td width="100"><?php echo $form->button('重置',array('type'=>'reset','class'=>'btn2'));?>  <!-- __('reset', true)取消-->
		</td>
	</tr>
</table>
<?php echo $form->end();?>


